package com.sskj.b70.v.activity;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.widget.TextView;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.b70.R;
import com.sskj.b70.common.widget.ToolBarLayout;
import com.sskj.b70.m.HttpConfig;
import com.sskj.b70.m.bean.HttpData;
import com.sskj.b70.m.http.JsonCallBack;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WebActivity extends AppCompatActivity {


    @BindView(R.id.web_toolbar)
    ToolBarLayout mWebToolbar;
    @BindView(R.id.tv_content)
    TextView tvContent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);
        ButterKnife.bind(this);
        mWebToolbar.setLeftButtonOnClickLinster(v -> finish());

        OkGo.<HttpData<UserAgreeMent>>get(HttpConfig.BASE_URL + HttpConfig.GET_XIEYI)
                .execute(new JsonCallBack<HttpData<UserAgreeMent>>() {
                    @Override
                    public void _onSuccess(Response<HttpData<UserAgreeMent>> response) {
                        HttpData<UserAgreeMent> httpListData = response.body();

                        tvContent.setText(Html.fromHtml(httpListData.getData().getAppUserAgreement()));
                    }
                });
    }


    public class UserAgreeMent {

        private String appUserAgreement;

        public String getAppUserAgreement() {
            return appUserAgreement;
        }

        public void setAppUserAgreement(String appUserAgreement) {
            this.appUserAgreement = appUserAgreement;
        }
    }
}
